package com.xquant.pricing.calc.controller;


import com.xquant.pricing.calc.mapper.DurationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * newCloud
 * 功能说明：计算服务场外期权
 * 编写作者：xeq
 * 开发日期：
 * 修改记录：修改日期   修改人    修改内容
 */
@RestController
@RequestMapping("duration")
public class CalcDurationController {

    @Autowired
    DurationMapper durationMapper;

    @Transactional(propagation = Propagation.REQUIRED)
    @RequestMapping(value = "remoteInsertDuration.action")
    public Map<String,Object> remoteInsertDurationService(@RequestParam Map<String, Object> param) {

        Map<String,Object> map = new HashMap<>();
        int ct = durationMapper.insertDuration(param);
        map.put("ct",ct);
        try {
            double a = 1 / 0;
        } catch (Exception e) {
            throw new RuntimeException();
        }
        return map;
    }
}
